import 'package:flutter/material.dart';
import '../../Constants/styles/app_style.dart';
import '../../Constants/constants.dart';

class RegesterPage extends StatelessWidget {
  //TextEditingController controller = TextEditingController();

  //昵称布局
  Row _layoutUserGet() {
    return new Row(
      children: <Widget>[
        SizedBox(width: Constants.Wh*58,),
        Expanded(flex:3,child:Text('昵称', style: TextStyleNw.inputBefore)),
        Expanded(
            flex:10,
            child: Row(children:[Expanded(child:TextField(
                decoration: InputDecoration(
                    border: InputBorder.none,
                    hintText: '例如：陈晨',
                    contentPadding: EdgeInsets.only(left: 0)),
                style: TextFieldStyleNw.input)),
                Container(
                  margin: EdgeInsets.only(right:Constants.Wh*32),
                  color: Color(AppColors.DisableBgColor),
                  width:Constants.Wh*180,height:Constants.Wh*180,
                  child:FlatButton(onPressed: (){}, padding: EdgeInsets.zero, child:
                  Image.asset('assets/images/ima_camera.png',width: Constants.Wh*50,height:  Constants.Wh*45,fit: BoxFit.fill,))),
                  ]))]
      
    );
  }

  //国家/地区布局
  Row _layoutLocalGet() {
    return new Row(
      children: <Widget>[
        SizedBox(width: Constants.Wh*58,),
        Expanded(flex:3,child: 
        Container(
          padding: EdgeInsets.symmetric(vertical:Constants.Hh*43),
          child:
        Text('国家/地区', style: TextStyleNw.inputBefore))),
        Expanded(flex:10,child:Text('中国大陆（+86）',
            style: TextStyle(
                color: Color(AppColors.MainColor),
                fontSize: Constants.Wh*48,
                fontWeight: FontWeight.w100,
                decoration: TextDecoration.none))),
      ],
    );
  }

  //手机号布局
  Row _layoutPhoneGet() {
    return new Row(
      children: <Widget>[
        SizedBox(width: Constants.Wh*58,),
        Expanded(flex:3,child:Container(padding:EdgeInsets.symmetric(vertical:Constants.Hh*43),child:Text('手机号', style: TextStyleNw.inputBefore))),
        Expanded(flex:10,
            child: TextField(
                decoration: InputDecoration(
                    border: InputBorder.none,
                    hintText: '请填写手机号',
                    contentPadding: EdgeInsets.only(left: 0.0)),
                style: TextFieldStyleNw.input))
      ],
    );
  }

  //密码布局
  Row _layoutPwdGet() {
    return new Row(
      children: <Widget>[
        SizedBox(width: Constants.Wh*58,),
        Expanded(flex:3,child:Container(padding:EdgeInsets.symmetric(vertical:Constants.Hh*43),child:Text('密码', style: TextStyleNw.inputBefore))),
        Expanded(flex:10,
            child: TextField(
                decoration: InputDecoration(
                    border: InputBorder.none,
                    hintText: '填写密码',
                    contentPadding: EdgeInsets.only(left: 0.0)),
                style: TextFieldStyleNw.input))
      ],
    );
  }

  //横向分割线
  Container _layoutHorizontalLine(bool special) {
    double rightZhi= Constants.Wh*34;
    if(special == true)
    {
       rightZhi= Constants.Wh*250;
    }
    return Container(
        height: 1.0,
        margin: EdgeInsets.only(left: Constants.Wh*34, right:rightZhi),
        color: Color(AppColors.SpliteLineColor));
  }

//阅读许可
  Row _layoutLincesRedGet() {
    return Row(
      children: <Widget>[
        SizedBox(width:Constants.Wh*32),
        Checkbox(
          value: true,
          onChanged: (newval) => {
          },
        ),
        Text('《软件许可及服务协议》',style: TextStyle(fontSize:Constants.Wh*35),)
      ],
    );
  }

//按钮
  Container _layoutBtnGet() {
    return   Container(
                      margin: EdgeInsets.only(
                          left: Constants.Wh * 44, right: Constants.Wh * 44),
                      child: MaterialButton(
                        minWidth: double.infinity,
                        //color: _btnColor,
                        color: Color(AppColors.DisableBgColor),
                        highlightColor: Color(AppColors.PressedBgColor),
                        elevation: 0,
                        padding: EdgeInsets.only(
                            top: Constants.Hh * 30, bottom: Constants.Hh * 30),
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(5)),
                        child: Text('注册',
                            style: TextStyle(
                                fontSize: Constants.Wh * 44,
                                //color: _btnTxtColor
                                )),
                        onPressed: () {
                          //if(controller.text.trim() == '' || controller.text.trim() == null)
                         // {}
                          //else{
                          //  Navigator.of(context).popAndPushNamed('/homePage');
                          //}
                        },)
                      );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      //color: Colors.white,
      body: SafeArea(child: SingleChildScrollView(child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          SizedBox(height:Constants.Hh*10),
          Container(
                  margin: EdgeInsets.only(right:Constants.Wh*32),
                  //color: Color(AppColors.DisableBgColor),
                  width:Constants.Wh*124,height:Constants.Wh*124,
                  child:FlatButton(onPressed: (){
                     Navigator.pop(context);
                  }, padding: EdgeInsets.zero, child:
                  Image.asset('assets/images/ima_cancel.png',width: Constants.Wh*42,height:  Constants.Wh*42,fit: BoxFit.fill,))),
          SizedBox(height:Constants.Hh*100),
          Container(
              padding: EdgeInsets.only(left: Constants.Wh*58),
              child: Text('手机号注册',
                  style: TextStyle(
                      decoration: TextDecoration.none,
                      color: Colors.black,
                      fontSize: Constants.Wh*70,
                      fontWeight: FontWeight.w100))),
          _layoutUserGet(),
          _layoutHorizontalLine(true),
          _layoutLocalGet(),
          _layoutPhoneGet(),
          _layoutHorizontalLine(false),
          _layoutPwdGet(),
          _layoutHorizontalLine(false),
          SizedBox(height:Constants.Hh*10),
          _layoutLincesRedGet(),
          _layoutBtnGet()
        ],
      )),
    ));
  }
}
